bitkeeper revision 1.148.1.1 (3e79d51dkKmlnq2cVH-XRz9_lkZeXg)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Thu, 20 Mar 2003 14:50:05 +0000 (14:50 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Thu, 20 Mar 2003 14:50:05 +0000 (14:50 +0000)
Many files:
  Allow up to 31 partitions per XL IDE or SCSI device. But can now only have 8 of each type of device.

xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_block.c
xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_block.h
xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_ide.c
xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_scsi.c
xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/block/xl_segment.c
xenolinux-2.4.21-pre4-sparse/include/linux/major.h
xenolinux-2.4.21-pre4-sparse/init/do_mounts.c

index 6fd44f1cc135c099b37bfbc03205d9d9dd3759a5..1c8022375acd98d963b46194e118559d2ebdb322 100644 (file)
@@ -15,8 +15,6 @@ typedef unsigned char byte; /* from linux/ide.h */
 #define XLBLK_RESPONSE_IRQ _EVENT_BLK_RESP
 #define DEBUG_IRQ          _EVENT_DEBUG 
 
-#define PARTN_SHIFT 4
-
 static blk_ring_t *blk_ring;
 static unsigned int resp_cons; /* Response consumer for comms ring. */
 static unsigned int req_prod;  /* Private request producer.         */
@@ -54,22 +52,20 @@ static inline unsigned short xldev_to_physdev(kdev_t xldev)
     switch ( MAJOR(xldev) ) 
     { 
     case XLIDE_MAJOR: 
-        physdev = XENDEV_IDE;
+        physdev = XENDEV_IDE + (MINOR(xldev) >> XLIDE_PARTN_SHIFT);
        break; 
        
     case XLSCSI_MAJOR: 
-        physdev = XENDEV_SCSI;
+        physdev = XENDEV_SCSI + (MINOR(xldev) >> XLSCSI_PARTN_SHIFT);
        break; 
 
     case XLVIRT_MAJOR:
-        physdev = XENDEV_VIRTUAL;
+        physdev = XENDEV_VIRTUAL + (MINOR(xldev) >> XLVIRT_PARTN_SHIFT);
         break;
     } 
 
     if ( physdev == 0 ) BUG();
 
-    physdev += (MINOR(xldev) >> PARTN_SHIFT);
-
     return physdev;
 }
 
@@ -102,7 +98,8 @@ static inline struct gendisk *xldev_to_gendisk(kdev_t xldev)
 static inline xl_disk_t *xldev_to_xldisk(kdev_t xldev)
 {
     struct gendisk *gd = xldev_to_gendisk(xldev);
-    return (xl_disk_t *)gd->real_devices + (MINOR(xldev) >> PARTN_SHIFT);
+    return (xl_disk_t *)gd->real_devices + 
+        (MINOR(xldev) >> PARTN_SHIFT(xldev));
 }
 
 
@@ -233,7 +230,7 @@ int xenolinux_block_revalidate(kdev_t dev)
     struct gendisk *gd = xldev_to_gendisk(dev);
     xl_disk_t *disk = xldev_to_xldisk(dev);
     unsigned long flags;
-    int i;
+    int i, partn_shift = PARTN_SHIFT(dev);
     
     spin_lock_irqsave(&io_request_lock, flags);
     if ( disk->usage > 1 )
@@ -243,15 +240,15 @@ int xenolinux_block_revalidate(kdev_t dev)
     }
     spin_unlock_irqrestore(&io_request_lock, flags);
 
-    for ( i = 0; i < (1 << PARTN_SHIFT); i++ )
+    for ( i = 0; i < (1 << partn_shift); i++ )
     {
         invalidate_device(dev + i, 1);
         gd->part[dev + i].start_sect = 0;
         gd->part[dev + i].nr_sects = 0;
     }
 
-    grok_partitions(gd, MINOR(dev) >> PARTN_SHIFT,
-                    1 << PARTN_SHIFT, disk->capacity);
+    grok_partitions(gd, MINOR(dev) >> partn_shift,
+                    1 << partn_shift, disk->capacity);
 
     return 0;
 }
index 42da335c4ab519cfce8e1e0b3ad3027e0414c387..3d219eeedcd46b951c7beb76388fb6a8d26e1ba4 100644 (file)
 #define DPRINTK_IOCTL(_f, _a...) ((void)0)
 #endif
 
+/* IDE/SCSI have <= 32 partitions per device. VIRT has <= 16. */
+#define PARTN_SHIFT(_dev) ((MAJOR(_dev)==XLVIRT_MAJOR) ? 4 : 5)
+#define XLIDE_PARTN_SHIFT  5
+#define XLSCSI_PARTN_SHIFT 5
+#define XLVIRT_PARTN_SHIFT 4
+
 /*
  * We have one of these per XL-IDE, XL-SCSI, and XL-VIRT device.
  * They hang in an array off the gendisk structure. We may end up putting
index 5e96f4197ba97cb097f5b86cf2bc75226a613944..599f9f6c0a1899b93bd55ba731b048a20140f242 100644 (file)
@@ -13,7 +13,6 @@
 /* We support up to 16 devices of up to 16 partitions each. */
 #define XLIDE_MAX         256
 #define XLIDE_MAJOR_NAME "xhd"
-#define IDE_PARTN_BITS    4
 static int xlide_blksize_size[XLIDE_MAX];
 static int xlide_hardsect_size[XLIDE_MAX];
 static int xlide_max_sectors[XLIDE_MAX];
@@ -80,18 +79,17 @@ int xlide_init(xen_disk_info_t *xdi)
      */
     blk_queue_headactive(BLK_DEFAULT_QUEUE(XLIDE_MAJOR), 0);
 
-    /* We may register up to 16 devices in a sparse identifier space. */
-    units = 16;
+    units = XLIDE_MAX >> XLIDE_PARTN_SHIFT;
 
     /* Construct an appropriate gendisk structure. */
-    minors    = units * (1<<IDE_PARTN_BITS);
+    minors    = units * (1<<XLIDE_PARTN_SHIFT);
     gd        = kmalloc(sizeof(struct gendisk), GFP_KERNEL);
     gd->sizes = kmalloc(minors * sizeof(int), GFP_KERNEL);
     gd->part  = kmalloc(minors * sizeof(struct hd_struct), GFP_KERNEL);
     gd->major        = XLIDE_MAJOR;
     gd->major_name   = XLIDE_MAJOR_NAME;
-    gd->minor_shift  = IDE_PARTN_BITS
-    gd->max_p       = 1<<IDE_PARTN_BITS;
+    gd->minor_shift  = XLIDE_PARTN_SHIFT
+    gd->max_p       = 1<<XLIDE_PARTN_SHIFT;
     gd->nr_real             = units;           
     gd->real_devices = kmalloc(units * sizeof(xl_disk_t), GFP_KERNEL);
     gd->next        = NULL;            
@@ -117,8 +115,8 @@ int xlide_init(xen_disk_info_t *xdi)
         ((xl_disk_t *)gd->real_devices)[disk].capacity =
             xdi->disks[i].capacity;
         register_disk(gd, 
-                      MKDEV(XLIDE_MAJOR, disk<<IDE_PARTN_BITS), 
-                      1<<IDE_PARTN_BITS
+                      MKDEV(XLIDE_MAJOR, disk<<XLIDE_PARTN_SHIFT), 
+                      1<<XLIDE_PARTN_SHIFT
                       &xlide_block_fops, 
                       xdi->disks[i].capacity);
     }
index e4d1007575ff591c80709d88b13975ea70102b01..8daadf8791bfd4098ff759fc37e9092ab3272bba 100644 (file)
@@ -13,7 +13,6 @@
 /* We support up to 16 devices of up to 16 partitions each. */
 #define XLSCSI_MAX        256
 #define XLSCSI_MAJOR_NAME "xsd"
-#define SCSI_PARTN_BITS   4
 static int xlscsi_blksize_size[XLSCSI_MAX];
 static int xlscsi_hardsect_size[XLSCSI_MAX];
 static int xlscsi_max_sectors[XLSCSI_MAX];
@@ -81,18 +80,17 @@ int xlscsi_init(xen_disk_info_t *xdi)
      */
     blk_queue_headactive(BLK_DEFAULT_QUEUE(XLSCSI_MAJOR), 0);
 
-    /* We may register up to 16 devices in a sparse identifier space. */
-    units = 16;
+    units = XLSCSI_MAX >> XLSCSI_PARTN_SHIFT;
 
     /* Construct an appropriate gendisk structure. */
-    minors    = units * (1<<SCSI_PARTN_BITS);
+    minors    = units * (1<<XLSCSI_PARTN_SHIFT);
     gd        = kmalloc(sizeof(struct gendisk), GFP_KERNEL);
     gd->sizes = kmalloc(minors * sizeof(int), GFP_KERNEL);
     gd->part  = kmalloc(minors * sizeof(struct hd_struct), GFP_KERNEL);
     gd->major        = XLSCSI_MAJOR;
     gd->major_name   = XLSCSI_MAJOR_NAME;
-    gd->minor_shift  = SCSI_PARTN_BITS
-    gd->max_p       = 1<<SCSI_PARTN_BITS;
+    gd->minor_shift  = XLSCSI_PARTN_SHIFT
+    gd->max_p       = 1<<XLSCSI_PARTN_SHIFT;
     gd->nr_real             = units;           
     gd->real_devices = kmalloc(units * sizeof(xl_disk_t), GFP_KERNEL);
     gd->next        = NULL;            
@@ -118,8 +116,8 @@ int xlscsi_init(xen_disk_info_t *xdi)
         ((xl_disk_t *)gd->real_devices)[disk].capacity =
             xdi->disks[i].capacity;
         register_disk(gd,
-                      MKDEV(XLSCSI_MAJOR, disk<<SCSI_PARTN_BITS), 
-                      1<<SCSI_PARTN_BITS
+                      MKDEV(XLSCSI_MAJOR, disk<<XLSCSI_PARTN_SHIFT), 
+                      1<<XLSCSI_PARTN_SHIFT
                       &xlscsi_block_fops, 
                       xdi->disks[i].capacity);
     }
index 6ef1838a2b87b669d4012008df0fd08a86d7d2de..48848f901061be05ae103488c908a62b574d09c1 100644 (file)
@@ -16,7 +16,6 @@ typedef unsigned char byte;
 /* We support up to 16 devices of up to 16 partitions each. */
 #define XLVIRT_MAX        256
 #define XLVIRT_MAJOR_NAME "xvd"
-#define VIRT_PARTN_BITS   4
 static int xlseg_blksize_size[XLVIRT_MAX];
 static int xlseg_hardsect_size[XLVIRT_MAX];
 static int xlseg_max_sectors[XLVIRT_MAX];
@@ -90,22 +89,17 @@ int __init xlseg_init(void)
      */
     blk_queue_headactive(BLK_DEFAULT_QUEUE(XLVIRT_MAJOR), 0);
 
-    /*
-     * We may register up to 16 devices in a sparse identifier space.
-     * Unlike with IDE and SCSI, we always register a gendisk, as new
-     * virtual devices may get allocate dto us later on.
-     */
-    units = 16;
+    units = XLVIRT_MAX >> XLVIRT_PARTN_SHIFT;
 
     /* Construct an appropriate gendisk structure. */
-    minors    = units * (1<<VIRT_PARTN_BITS);
+    minors    = units * (1<<XLVIRT_PARTN_SHIFT);
     gd        = kmalloc(sizeof(struct gendisk), GFP_KERNEL);
     gd->sizes = kmalloc(minors * sizeof(int), GFP_KERNEL);
     gd->part  = kmalloc(minors * sizeof(struct hd_struct), GFP_KERNEL);
     gd->major        = XLVIRT_MAJOR;
     gd->major_name   = XLVIRT_MAJOR_NAME;
-    gd->minor_shift  = VIRT_PARTN_BITS
-    gd->max_p       = 1<<VIRT_PARTN_BITS;
+    gd->minor_shift  = XLVIRT_PARTN_SHIFT
+    gd->max_p       = 1<<XLVIRT_PARTN_SHIFT;
     gd->nr_real             = units;           
     gd->real_devices = kmalloc(units * sizeof(xl_disk_t), GFP_KERNEL);
     gd->next        = NULL;            
@@ -132,8 +126,8 @@ int __init xlseg_init(void)
         ((xl_disk_t *)gd->real_devices)[disk].capacity =
             xdi->disks[i].capacity;
         register_disk(gd, 
-                      MKDEV(XLVIRT_MAJOR, disk<<VIRT_PARTN_BITS), 
-                      1<<VIRT_PARTN_BITS
+                      MKDEV(XLVIRT_MAJOR, disk<<XLVIRT_PARTN_SHIFT), 
+                      1<<XLVIRT_PARTN_SHIFT
                       &xlsegment_block_fops, 
                       xdi->disks[i].capacity);
     }
index 0fd779a17087cfd03824915c1844b82acf0da59b..6b22ee5812a1b71a05fe0b1853cf7137844f45b0 100644 (file)
 #define        UMEM_MAJOR      116     /* http://www.umem.com/ Battery Backed RAM */
 
 /*
- * Each of these majors supports up to 16 devices of <= 16 partitions each.
- * eg. xhda == (123, 0), xhdb == (123, 16), ...
- *     xsda == (124, 0), xsdb == (124, 16), ...
+ * XLIDE/XLSCSI each support up to 8 devices of <= 32 partitions each.
+ * XLVIRT supports 16 devices of <= 16 partitions each.
+ * eg. xhda == (123, 0), xhdb == (123, 32), ...
+ *     xsda == (124, 0), xsdb == (124, 32), ...
  *     xvda == (125, 0), xvdb == (125, 16), ...
  */
 #define XLIDE_MAJOR    123     /* XenoLinux IDE Device */
index 4e876b6e0c10c71a2fa898a5f706337747cd4458..16aca7bb8ced07a317643452004e5338fe7855fc 100644 (file)
@@ -232,23 +232,15 @@ static struct dev_name_struct {
        { "ataraid/d15p",0x72F0 },
 #if defined(CONFIG_XENOLINUX_BLOCK)
         /* XenoLinux IDE Devices */
-        { "xhda", 0x7B00 }, { "xhdb", 0x7B10 },
-        { "xhdc", 0x7B20 }, { "xhdd", 0x7B30 },
-        { "xhde", 0x7B40 }, { "xhdf", 0x7B50 },
-        { "xhdg", 0x7B60 }, { "xhdh", 0x7B70 },
-        { "xhdi", 0x7B80 }, { "xhdj", 0x7B90 },
-        { "xhdk", 0x7BA0 }, { "xhdl", 0x7BB0 },
-        { "xhdm", 0x7BC0 }, { "xhdn", 0x7BD0 },
-        { "xhdo", 0x7BE0 }, { "xhdp", 0x7BF0 },
+        { "xhda", 0x7B00 }, { "xhdb", 0x7B20 },
+        { "xhdc", 0x7B40 }, { "xhdd", 0x7B60 },
+        { "xhde", 0x7B80 }, { "xhdf", 0x7BA0 },
+        { "xhdg", 0x7BC0 }, { "xhdh", 0x7BE0 },
         /* Xenolinux SCSI Devices */
-        { "xsda", 0x7C00 }, { "xsdb", 0x7C10 },
-        { "xsdc", 0x7C20 }, { "xsdd", 0x7C30 },
-        { "xsde", 0x7C40 }, { "xsdf", 0x7C50 },
-        { "xsdg", 0x7C60 }, { "xsdh", 0x7C70 },
-        { "xsdi", 0x7C80 }, { "xsdj", 0x7C90 },
-        { "xsdk", 0x7CA0 }, { "xsdl", 0x7CB0 },
-        { "xsdm", 0x7CC0 }, { "xsdn", 0x7CD0 },
-        { "xsdo", 0x7CE0 }, { "xsdp", 0x7CF0 },
+        { "xsda", 0x7C00 }, { "xsdb", 0x7C20 },
+        { "xsdc", 0x7C40 }, { "xsdd", 0x7C60 },
+        { "xsde", 0x7C80 }, { "xsdf", 0x7CA0 },
+        { "xsdg", 0x7CC0 }, { "xsdh", 0x7CE0 },
         /* XenoLinux Virtual Devices */
         { "xvda", 0x7D00 }, { "xvdb", 0x7D10 },
         { "xvdc", 0x7D20 }, { "xvdd", 0x7D30 },